import styles from "./Index.module.less";
import FontIcon from "@/components/public/fontIcon/Index";

interface MenuItem {
  key: string;
  name: string;
  icon?: string;
  onClick?: () => void;
}

interface Props {
  x: number;
  y: number;
  show: boolean;
  list: MenuItem[];
}
export default function Index({ x, y, show, list }: Props) {
  return show ? (
    <div className={styles.popup} style={{ left: x, top: y }}>
      {list?.map((item) => {
        return (
          <div key={item.name} className={styles.item} onClick={item.onClick}>
            {item.icon ? <FontIcon name={item.icon} size="12px" /> : null}
            <div className={styles.text}>{item.name}</div>
          </div>
        );
      })}
    </div>
  ) : null;
}
